<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>计算属性</title>
</head>

<body>
    <div id="app">
        <p>Original message: {{ message }}</p>
        <p>Reversed Message: {{ message.split('').reverse().join('') }}</p>
        <p>Computed reversed message: {{ reversedMessage }}</p>
        <p>Invoke Method reverse message: {{ reverseMsg() }}</p>
    </div>

    <script type="module">
        import Vue from '../vue.esm.browser.js'

        const app = new Vue({
            el: '#app',
            data: {
                message: 'Hello World!'
            },
            computed: {
                reversedMessage: function () {
                    return this.message.split('').reverse().join('')
                }
            },
            methods: {
                reverseMsg() {
                    return this.message.split('').reverse().join('')
                }
            }
        })
    </script>
</body>

</html>